﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace CPPProject.Migrations
{
    public partial class add2 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "T_Sys_ButtonsForModule");

            migrationBuilder.DropTable(
                name: "T_Sys_ChildrenModule");

            migrationBuilder.DropTable(
                name: "T_Sys_ColumnsForModule");

            migrationBuilder.DropTable(
                name: "T_Sys_CustomerRegist");

            migrationBuilder.DropTable(
                name: "T_Sys_Doc");

            migrationBuilder.DropTable(
                name: "T_Sys_Logs");

            migrationBuilder.DropTable(
                name: "T_Sys_Module");

            migrationBuilder.DropTable(
                name: "T_Sys_Params");

            migrationBuilder.DropTable(
                name: "T_Sys_RegisterCompany");

            migrationBuilder.DropTable(
                name: "T_Sys_RoleForButton");

            migrationBuilder.DropTable(
                name: "T_Sys_RoleForColumn");

            migrationBuilder.DropTable(
                name: "T_Sys_RoleForModule");

            migrationBuilder.DropTable(
                name: "T_Sys_Roles");

            migrationBuilder.DropTable(
                name: "T_Sys_Sequence");

            migrationBuilder.DropTable(
                name: "T_Sys_User");

            migrationBuilder.DropTable(
                name: "T_Sys_UserInRole");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "T_Sys_ButtonsForModule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CButtonID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CButtonName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_ButtonsForModule", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_ChildrenModule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CChildrenModuleCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_ChildrenModule", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_ColumnsForModule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CAlign = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CColumnRender = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CDataType = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CField = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CHeaderRender = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CSummaryType = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CTitle = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    IShow = table.Column<int>(type: "int", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NOrderID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NWidth = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_ColumnsForModule", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_CustomerRegist",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    AuditDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    AuditUser = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CAddress = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CContact = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CEmail = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CPassward = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CPhone = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CPictureAddress = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    IsAudit = table.Column<int>(type: "int", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCustomerCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    RegistDate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_CustomerRegist", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_Doc",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CClass = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CFileName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CFilePath = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CFormat = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CPhysicalPath = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    DUploadDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NSize = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_Doc", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_Logs",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CIPAddress = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    DDateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NModuleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NUserID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_Logs", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_Module",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CIcon = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleCode = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
                    CPath = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CTitle = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CUrl = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    IUse = table.Column<int>(type: "int", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NModuleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NOrderID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NPModuleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_Module", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_Params",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CDescription = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CType = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CValue = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_Params", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_RegisterCompany",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CAddress = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CCompanyName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CEmail = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CEntNo = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CLicenseUrl = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CPhone = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CTelephone = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    DActiveDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IActive = table.Column<int>(type: "int", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_RegisterCompany", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_RoleForButton",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CButtonID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NRoleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_RoleForButton", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_RoleForColumn",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CField = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CModuleCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NRoleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_RoleForColumn", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_RoleForModule",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CModuleCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NRoleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_RoleForModule", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_Roles",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CDescription = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    ISuperAdmin = table.Column<int>(type: "int", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NRoleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NUpRoleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_Roles", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_Sequence",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    Formatter = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Last_Value = table.Column<int>(type: "int", nullable: false),
                    Leading_Str = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Seq_Desc = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Seq_Name = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    Step = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_Sequence", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_User",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    CEasyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CEmail = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CIPAddress = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CNickName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CPassword = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CRelationCode = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CTelephone = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CToken = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    DLoginTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ISex = table.Column<int>(type: "int", nullable: false),
                    IStatus = table.Column<int>(type: "int", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NUserID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    OPENID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_User", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "T_Sys_UserInRole",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                    NCompanyID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NRoleID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    NUserID = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_Sys_UserInRole", x => x.Id);
                });
        }
    }
}
